package org.zoomdev.zoom.web.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public abstract class ActionHandler {

    /**
     * 路由路径上的参数 /page/{id}/{name}   =>>>>   ["id","name"]
     */
    private final String[] pathVariableNames;
    /**
     * @Controller对应的key 与 @Mapping 拼接而成的最终key
     */
    private final String key;
    /**
     * 支持的http方法，如GET POST
     */
    private final String[] methods;

    public ActionHandler(String key, String[] methods, String[] pathVariableNames) {
        this.key = key;
        this.methods = methods;
        this.pathVariableNames = pathVariableNames;
    }

    public String getKey() {
        return key;
    }

    public String[] getMethods() {
        return methods;
    }

    public String[] getPathVariableNames() {
        return pathVariableNames;
    }

    public abstract void handle(HttpServletRequest request, HttpServletResponse response) throws Throwable;
}
